package com.liruo.learn.spring.security.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:liruo
 * @Date:2023-05-18-19:17:44
 * @Desc
 */
@RestController
@RequestMapping("/test")
public class AuthorizationTestController {
    @GetMapping("/any")
    public String any(){
        return "any";
    }
    @PreAuthorize("hasRole('admin')")
    @GetMapping("/anno/hasRole")
    public String annoHasRoleTest(){
        return "hasRole";
    }
    @GetMapping("/hasRole")
    public String hasRoleTest(){
        return "hasRole";
    }

}
